Imports System.Drawing.Printing
Imports DevExpress.XtraReports.UI
Imports DevExpress.XtraReports.Parameters
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Controls

Public Class rptDetalleProducto
    Private currentSortCell As XRTableCell

    Private Sub subRptDetalleProductos_BeforePrint(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintEventArgs)
        Try

            'CType(sender, XRSubreport).ReportSource = New rptProductosPorFactura
            'Dim detail As rptProductosPorFactura = TryCast(subRptDetalleProductos.ReportSource, rptProductosPorFactura)
            'If Detail IsNot Nothing Then
            '    detail.factid.Value = Convert.ToInt32(GetCurrentColumnValue("idfactura"))
            '    'detail.factid.Value = Convert.ToInt32(60293)
            '    detail.ApplyFiltering()
            '    'e.Cancel = Detail.RowCount = 0
            'End If
        Catch ex As Exception
            MessageBox.Show(ex.ToString())
        End Try
    End Sub

    Private Sub rptDetalleProducto_ParametersRequestBeforeShow(ByVal sender As System.Object, ByVal e As DevExpress.XtraReports.Parameters.ParametersRequestEventArgs) Handles MyBase.ParametersRequestBeforeShow
        Dim DataSet As New dbFireAndIceDataSet
        Dim EmpresasTA As New dbFireAndIceDataSetTableAdapters.empresasTableAdapter
        Dim NominasTA As New dbFireAndIceDataSetTableAdapters.nominastipoTableAdapter
        EmpresasTA.Fill(DataSet.empresas)
        NominasTA.Fill(DataSet.nominastipo)

        Dim Info As ParameterInfo
        For Each Info In e.ParametersInformation
            If Info.Parameter.Name = "empresa" Then
                Dim LookUpEditEmpresa As New LookUpEdit()
                LookUpEditEmpresa.Properties.DataSource = DataSet.empresas
                LookUpEditEmpresa.Properties.DisplayMember = "descripcion"
                LookUpEditEmpresa.Properties.ValueMember = "idempresa"
                LookUpEditEmpresa.Properties.Columns.Add(New  _
                LookUpColumnInfo("descripcion", 0, "Empresa"))
                Info.Editor = LookUpEditEmpresa
            End If
            If Info.Parameter.Name = "nomina" Then
                Dim LookUpEditNM1 As New LookUpEdit()
                LookUpEditNM1.Properties.DataSource = DataSet.nominastipo
                LookUpEditNM1.Properties.DisplayMember = "descripcion"
                LookUpEditNM1.Properties.ValueMember = "idnomina"
                LookUpEditNM1.Properties.Columns.Add(New  _
                LookUpColumnInfo("descripcion", 0, "Tipo de nomina"))
                Info.Editor = LookUpEditNM1
            End If
            If Info.Parameter.Name = "nomina2" Then
                Dim LookUpEditNM2 As New LookUpEdit()
                LookUpEditNM2.Properties.DataSource = DataSet.nominastipo
                LookUpEditNM2.Properties.DisplayMember = "descripcion"
                LookUpEditNM2.Properties.ValueMember = "idnomina"
                LookUpEditNM2.Properties.Columns.Add(New  _
                LookUpColumnInfo("descripcion", 0, "Tipo de nomina"))
                Info.Editor = LookUpEditNM2
            End If
        Next Info
    End Sub

End Class